import { defineComponent, onMounted } from "vue";
import styles from "./Footer.module.scss";
import SafeArea from "@/components/safe-area/safe-area.vue";
import { IconFont } from '@nutui/icons-vue';
import YSF from '@neysf/qiyu-web-sdk';
export default defineComponent({
  props: {
    total_price: {
      type: Number,
      default: 0,
    }
  },
  setup(props) {
    let ysfInstance: any = null;
    onMounted(() => {
      YSF.init('2786a0197050886cced51c5a033cc6cf', {
        hidden: 1,
        subdomain: 1,
      }, null).then(ysf => {
        ysfInstance = ysf;
      });
    })
    // 提交
    const submit = () => {

    }
    return () => (
      <div class={styles.footer}>
        <div class={styles['footer-container']}>
          <div class={styles['footer-toolbar']}>
            <div class={styles['toolbar-item']} onClick={() => { ysfInstance('open') }}>
              <IconFont name="service" />
              <span>客服</span>
            </div>
          </div>
          <div class={styles['footer-total']}>
            <span>
              <span>保险费合计:<span class={styles.amount}>{props.total_price}</span>元</span>
            </span>
          </div>
          <div class={[styles['submit']]} onClick={() => { submit() }}>立即参保</div>
        </div>
        <SafeArea />
      </div>
    )
  }
})